/**
 * @author Mario
 */

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;

import javax.swing.ImageIcon;
import javax.swing.JButton;

class myButton extends JButton
{
	ImageIcon text;
	String texts;
	public myButton(String txt)
	 {
		text = new ImageIcon(txt);
		texts = txt;
		//super(new ImageIcon(txt));
		setPreferredSize(new Dimension(190, 30));
		setMinimumSize(new Dimension(190, 30));
		//setContentAreaFilled(false);
	 }
	public void paintComponent(Graphics g)
		{   
		super.paintComponent(g);
		Graphics2D g2 = (Graphics2D) g;
				ImageIcon p = new ImageIcon("startButton.png");
				

		Paint oldPaint = g2.getPaint();
		g2.drawImage(p.getImage(),0,0,null);
		//g2.drawImage(text.getImage(), 0, 0,null);
		g2.drawString(texts, (190-texts.length()*6)/2, 20);//six pixels and 1 pix between letters
		//g2.fillRect(0, 0, getWidth(), getHeight());
		//g2.setPaint(oldPaint);
		//g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

		
		}
}